package com.eairlv.route.client.interceptor;

import com.eairlv.route.client.entity.RouteForm;
import com.eairlv.route.client.entity.RouteHandlerForm;
import feign.Target;

import java.lang.reflect.Method;

/**
 * @author eairlv
 * @description
 * @date 18:08 2019/12/12
 */
public interface RouteInterceptor {

    /**
     * 获取route时的key。由于使用GET方式请求因此key最好做一次URL编码
     * @param key
     * @param type
     * @param method
     * @param args
     * @param target
     * @return
     */
    String applyKey(Object key, Integer type, Method method, Object[] args, Target target);

    /**
     * 获取route时的type
     * @param key
     * @param type
     * @param method
     * @param args
     * @param target
     * @return
     */
    Integer applyType(Object key, Integer type, Method method, Object[] args, Target target);

    /**
     * 设置route时的路由对象
     * @param routeHandlerForm
     * @param method
     * @param args
     * @param target
     * @return
     */
    RouteForm applyRoute(RouteHandlerForm routeHandlerForm, Method method, Object[] args, Target target);
}
